package com.iecas.entity;

import com.iecas.enums.Direction;

import java.awt.*;

public class Bullet extends Base implements GameObject{

    public Bullet(int x, int y, int width, int height, Direction direction) {
        setX(x);
        setY(y);
        setWidth(width);
        setHeight(height);
        setDirection(direction);
        setSpeed(10);
    }

    @Override
    public Rectangle getBounds() {
        return  new Rectangle(x, y, width, height);
    }

    public boolean intersects(GameObject obj) {
        Rectangle bulletRect = new Rectangle(x, y, 6, 6);
        return bulletRect.intersects(obj.getBounds());
    }
}
